<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <script src="./vue.js"></script>
</head>

<body>
    <div id="wrap">
        <div ref="demo">{{message}}</div>
        <button @click="change"> Click Me</button>
    </div>
</body>
<script>

    new Vue({
        el: "#wrap",
        data: {
            message: '这个是一个data里的message'
        },
        methods: {
            change() {
                this.message = '这个是更改之后的message';
            }
        },
        beforeCreate() {
            // 有this->VUE 没有data数据 没有DOM
            console.log('beforeCreat->', this)
            console.log('beforeCreat->', this.message)
            console.log('beforeCreat->', this.$refs.demo)
            console.log('--------------------------------------')
        },
        created() {
            // 有this->VUE 有data数据 没有DOM
            console.log('created->', this)
            console.log('created->', this.message)
            console.log('created->', this.$refs.demo)
            console.log('--------------------------------------')
        },
        beforeMount() {

            console.log('beforeMount->', this)
            console.log('beforeMount->', this.message)
            console.log('beforeMount->', this.$refs.demo)
            console.log('--------------------------------------')
        },
        mounted() {

            console.log('mounted->', this)
            console.log('mounted->', this.message)
            console.log('mounted->', this.$refs.demo)
            console.log('--------------------------------------')
        },
        beforeUpdate() {

            console.log('beforeUpdate->', this)
            console.log('beforeUpdate->', this.message)
            console.log('beforeUpdate->', this.$refs.demo)
            console.log('--------------------------------------')
        },
        updated() {
            console.log('updated->', this)
            console.log('updated->', this.message)
            console.log('updated->', this.$refs.demo)
            console.log('--------------------------------------')
        }
    })


</script>

</html>